package com.example.administrator.xiaoxiang.adapter;

import android.content.Context;
import android.view.View;

import com.bumptech.glide.Glide;
import com.example.administrator.xiaoxiang.R;
import com.example.administrator.xiaoxiang.data.RebateDate;
import com.example.administrator.xiaoxiang.utils.ShareSDKUtils;

import java.util.List;

/**
 * Created by Administrator on 2017/1/6.
 */

public class RebateAdapter extends SimpleAdapter<RebateDate.BodyBean.RebateGoodsBean> {
    private Context mContext;
    public RebateAdapter(Context context, List<RebateDate.BodyBean.RebateGoodsBean> datas) {
        super(context, datas, R.layout.rebateitem);
        mContext=context;
    }

    @Override
    public void bindData(BaseViewHolder holder, final RebateDate.BodyBean.RebateGoodsBean rebateGoodsBean) {
        Glide.with(mContext).load(rebateGoodsBean.getThumbnailUrl()).centerCrop().into(holder.getImageView(R.id.iv_rebateitem));
        holder.getTextView(R.id.tv_rebata_title).setText(rebateGoodsBean.getGoodsName());
        String pice=rebateGoodsBean.getRebateCash()+"";
        holder.getTextView(R.id.rebate_tv_money).setText(pice.substring(0,pice.length()-2)+"元");

        holder.getTextView(R.id.rebare_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ShareSDKUtils.showShare(mContext,rebateGoodsBean.getGoodsName(),rebateGoodsBean.getThumbnailUrl(),"");

            }
        });

    }

}
